#pragma once
#include"Log.hpp"
#include"Socket.hpp"

class TcpServer
{
public:
    TcpServer()
    {}
    bool InitServer()
    {
        _listensock.Socket();
        _listensock.Bind(_port);
        _listensock.Listen();
    }
    void Start()
    {
        while(true)
        {
            string clientip;
            uint16_t clientport;
            int sockfd = _listensock.Accept(&clientip, &clientport);
            if(sockfd < 0) continue;
            //serve
        }
    }
private:
    uint16_t _port;
    Sock _listensock;
};